//
//  WodeViewController.m
//  KCZ_B段项目
//
//  Created by dllo on 15/11/3.
//  Copyright © 2015年 Sky. All rights reserved.
//

#import "WodeViewController.h"
#import "ZJHWoDeTableViewCell.h"
#import "ZJHSetViewController.h"
#import "FitHeader.h"
#import "CYVideoCollectViewController.h"
#import "KAboutUsViewController.h"
@interface WodeViewController ()<UITableViewDataSource, UITableViewDelegate>
@property(nonatomic, strong)UITableView *tableView;
@property(nonatomic, strong)NSMutableArray *titleArray;
@property(nonatomic, strong)NSMutableArray *leftImageArray;
@end

@implementation WodeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    self.title = @"我的";
    self.navigationController.navigationBar.translucent = NO;
    [self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor], NSForegroundColorAttributeName, nil]];
    [self.navigationController.navigationBar setTintColor:[UIColor whiteColor]];//navigationcontroller上的颜色为白色
    // Do any additional setup after loading the view.
}
-(void)loadView
{
    [super loadView];
    //初始化celltitle数组
    _titleArray = [NSMutableArray arrayWithObjects:@"我的收藏", @"设置", @"关于我们", nil];
    
    //初始化cell右侧图标数组
    _leftImageArray = [NSMutableArray arrayWithObjects:@"iconfont-wodeshoucang", @"iconfont-shezhi", @"iconfont-02gengduoguanyuwomen", nil];
    
    //创建界面
    [self createUI];
}

#pragma mark 创建UI
-(void)createUI
{
    _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 20 * ht, self.view.frame.size.width, self.view.frame.size.height - 104 - 20 * ht)];
    _tableView.bounces = NO;
    _tableView.delegate = self;
    _tableView.dataSource = self;
    _tableView.tableFooterView = [[UITableView alloc]init];
    [self.view addSubview:_tableView];
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *identifier = @"userCell";
    ZJHWoDeTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
    if (!cell) {
        cell = [[ZJHWoDeTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
    }
    cell.titleLable.text = _titleArray[indexPath.row];
    cell.leftImageView.image = [UIImage imageNamed:_leftImageArray[indexPath.row]];
    return cell;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return _titleArray.count;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 40 * ht;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    switch (indexPath.row) {
        case 0:
        {
            CYVideoCollectViewController *cvc = [[CYVideoCollectViewController alloc]init];
            cvc.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:cvc animated:YES];
        }
            break;
        case 1:
        {
            ZJHSetViewController *setVC = [[ZJHSetViewController alloc]init];
            setVC.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:setVC animated:YES];
        }
            break;
        case 2:
        {
            KAboutUsViewController *aboutVC = [[KAboutUsViewController alloc]init];
            aboutVC.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:aboutVC animated:YES];
        }
            break;
        default:
            break;
    }
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
